package org.jeecg.modules.xxgx.cxtj.vo;

import cn.afterturn.easypoi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang.StringUtils;
import org.jeecg.modules.common.util.MathUtil;
import org.jeecg.modules.xxgx.common.enums.FplxdmEnum;

import java.math.BigDecimal;

@Data
@ApiModel(description="发票统计（多维度）返回参数")
public class XxFptjDwdDTO {
    @ApiModelProperty(value = "统计维度")
    String tjfs;

    @Excel(name = "统计维度",orderNum = "0")
    @ApiModelProperty(value = "统计维度名称")
    String tjfs_dictText;

    @ApiModelProperty(value = "发票类型代码")
    String fplxdm;

    @Excel(name = "发票类型",orderNum = "0")
    @ApiModelProperty(value = "发票类型名称")
    String fplxmc;
    public String getFplxmc() {
        if(StringUtils.isNotEmpty(this.getFplxdm())) {
            return FplxdmEnum.getDescByValue(this.getFplxdm());
        } else {
            return "";
        }
    }
    @Excel(name = "税率",orderNum = "1")
    @ApiModelProperty(value = "税率")
    String tax;

    public String getTax() {
        if(StringUtils.isNotEmpty(tax)){
            BigDecimal taxBigDecimal = new BigDecimal(tax);
            tax = taxBigDecimal.multiply(new BigDecimal("100")).toPlainString();

            tax = tax + "%";
        }
        return tax;
    }

    @Excel(name = "正数发票金额",orderNum = "2")
    @ApiModelProperty(value = "正数发票合计金额")
    BigDecimal zsHjje;
    @Excel(name = "正数发票税额",orderNum = "3")
    @ApiModelProperty(value = "正数发票合计税额")
    BigDecimal zsHjse;

    @Excel(name = "正数发票作废金额",orderNum = "4")
    @ApiModelProperty(value = "正数发票作废合计金额")
    BigDecimal zfHjje;
    @Excel(name = "正数发票作废税额",orderNum = "5")
    @ApiModelProperty(value = "正数发票作废合计税额")
    BigDecimal zfHjse;

    @Excel(name = "负数发票金额",orderNum = "6")
    @ApiModelProperty(value = "负数发票合计金额")
    BigDecimal fsHjje;
    @Excel(name = "负数发票税额",orderNum = "7")
    @ApiModelProperty(value = "负数发票合计税额")
    BigDecimal fsHjse;

    @Excel(name = "负数发票作废金额",orderNum = "8")
    @ApiModelProperty(value = "负数发票作废合计金额")
    BigDecimal ffHjje;
    @Excel(name = "负数发票作废税额",orderNum = "9")
    @ApiModelProperty(value = "负数发票作废合计税额")
    BigDecimal ffHjse;



    @Excel(name = "实际销售情况金额",orderNum = "10")
    @ApiModelProperty(value = "实际销售情况合计金额")
    private BigDecimal sjxsqkHjje;

    @Excel(name = "实际销售情况税额",orderNum = "11")
    @ApiModelProperty(value = "实际销售情况合计税额")
    private BigDecimal sjxsqkHjse;

    /**
     * 计算 实际销售情况合计金额
     * @return
     */
    public BigDecimal getSjxsqkHjje() {
        BigDecimal zsHjje = this.getZsHjje()!=null?this.getZsHjje():BigDecimal.ZERO;
        BigDecimal fsHjje = this.getFsHjje()!=null?this.getFsHjje():BigDecimal.ZERO;
        return MathUtil.add(zsHjje,fsHjje);
    }

    /**
     * 计算 实际销售情况合计税额
     * @return
     */
    public BigDecimal getSjxsqkHjse() {
        BigDecimal zsHjse = this.getZsHjse()!=null?this.getZsHjse():BigDecimal.ZERO;
        BigDecimal fsHjse = this.getFsHjse()!=null?this.getFsHjse():BigDecimal.ZERO;
        return MathUtil.add(zsHjse,fsHjse);
    }
}
